misc/util.js \
perf/core.js \
ui/altTab.js \
+ ui/animation.js \
ui/appDisplay.js \
ui/appFavorites.js \
ui/backgroundMenu.js \
--- /dev/null
+// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
+
+const Lang = imports.lang;
+const Mainloop = imports.mainloop;
+const St = imports.gi.St;
+const Signals = imports.signals;
+const Atk = imports.gi.Atk;
+
+const ANIMATED_ICON_UPDATE_TIMEOUT = 100;
+
+const Animation = new Lang.Class({
+ Name: 'Animation',
+
+ _init: function(filename, width, height, speed) {
+ this.actor = new St.Bin();
+ this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
+ this._speed = speed;
+
+ this._isLoaded = false;
+ this._isPlaying = false;
+ this._timeoutId = 0;
+ this._frame = 0;
+ this._animations = St.TextureCache.get_default().load_sliced_image (filename, width, height,
+ Lang.bind(this, this._animationsLoaded));
+ this.actor.set_child(this._animations);
+ },
+
+ play: function() {
+ if (this._isLoaded && this._timeoutId == 0) {
+ if (this._frame == 0)
+ this._showFrame(0);
+
+ this._timeoutId = Mainloop.timeout_add(this._speed, Lang.bind(this, this._update));
+ }
+
+ this._isPlaying = true;
+ },
+
+ stop: function() {
+ if (this._timeoutId > 0) {
+ Mainloop.source_remove(this._timeoutId);
+ this._timeoutId = 0;
+ }
+
+ this._isPlaying = false;
+ },
+
+ _showFrame: function(frame) {
+ let oldFrameActor = this._animations.get_child_at_index(this._frame);
+ if (oldFrameActor)
+ oldFrameActor.hide();
+
+ this._frame = (frame % this._animations.get_n_children());
+
+ let newFrameActor = this._animations.get_child_at_index(this._frame);
+ if (newFrameActor)
+ newFrameActor.show();
+ },
+
+ _update: function() {
+ this._showFrame(this._frame + 1);
+ return true;
+ },
+
+ _animationsLoaded: function() {
+ this._isLoaded = true;
+
+ if (this._isPlaying)
+ this.play();
+ },
+
+ _onDestroy: function() {
+ this.stop();
+ }
+});
+
+const AnimatedIcon = new Lang.Class({
+ Name: 'AnimatedIcon',
+ Extends: Animation,
+
+ _init: function(filename, size) {
+ this.parent(filename, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
+ }
+});
const Params = imports.misc.params;
+const Animation = imports.ui.animation;
const Layout = imports.ui.layout;
const Lightbox = imports.ui.lightbox;
const Main = imports.ui.main;
},
placeSpinner: function(layoutInfo) {
- /* This is here because of recursive imports */
- const Panel = imports.ui.panel;
let spinnerIcon = global.datadir + '/theme/process-working.svg';
- this._workSpinner = new Panel.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
+ this._workSpinner = new Animation.AnimatedIcon(spinnerIcon, WORK_SPINNER_ICON_SIZE);
this._workSpinner.actor.opacity = 0;
this._workSpinner.actor.show();
const Atk = imports.gi.Atk;
+const Animation = imports.ui.animation;
const Config = imports.misc.config;
const CtrlAltTab = imports.ui.ctrlAltTab;
const DND = imports.ui.dnd;
const BUTTON_DND_ACTIVATION_TIMEOUT = 250;
-const ANIMATED_ICON_UPDATE_TIMEOUT = 100;
const SPINNER_ANIMATION_TIME = 0.2;
// To make sure the panel corners blend nicely with the panel,
blue: blue, alpha: color.alpha });
};
-const Animation = new Lang.Class({
- Name: 'Animation',
-
- _init: function(filename, width, height, speed) {
- this.actor = new St.Bin();
- this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
- this._speed = speed;
-
- this._isLoaded = false;
- this._isPlaying = false;
- this._timeoutId = 0;
- this._frame = 0;
- this._animations = St.TextureCache.get_default().load_sliced_image (filename, width, height,
- Lang.bind(this, this._animationsLoaded));
- this.actor.set_child(this._animations);
- },
-
- play: function() {
- if (this._isLoaded && this._timeoutId == 0) {
- if (this._frame == 0)
- this._showFrame(0);
-
- this._timeoutId = Mainloop.timeout_add(this._speed, Lang.bind(this, this._update));
- }
-
- this._isPlaying = true;
- },
-
- stop: function() {
- if (this._timeoutId > 0) {
- Mainloop.source_remove(this._timeoutId);
- this._timeoutId = 0;
- }
-
- this._isPlaying = false;
- },
-
- _showFrame: function(frame) {
- let oldFrameActor = this._animations.get_child_at_index(this._frame);
- if (oldFrameActor)
- oldFrameActor.hide();
-
- this._frame = (frame % this._animations.get_n_children());
-
- let newFrameActor = this._animations.get_child_at_index(this._frame);
- if (newFrameActor)
- newFrameActor.show();
- },
-
- _update: function() {
- this._showFrame(this._frame + 1);
- return true;
- },
-
- _animationsLoaded: function() {
- this._isLoaded = true;
-
- if (this._isPlaying)
- this.play();
- },
-
- _onDestroy: function() {
- this.stop();
- }
-});
-
-const AnimatedIcon = new Lang.Class({
- Name: 'AnimatedIcon',
- Extends: Animation,
-
- _init: function(filename, size) {
- this.parent(filename, size, size, ANIMATED_ICON_UPDATE_TIMEOUT);
- }
-});
-
const TextShadower = new Lang.Class({
Name: 'TextShadower',
if (!success || this._spinnerIcon == icon)
return;
this._spinnerIcon = icon;
- this._spinner = new AnimatedIcon(this._spinnerIcon, PANEL_ICON_SIZE);
+ this._spinner = new Animation.AnimatedIcon(this._spinnerIcon, PANEL_ICON_SIZE);
this._container.add_actor(this._spinner.actor);
this._spinner.actor.hide();
this._spinner.actor.lower_bottom();